\(\int \frac {A+B x}{(a+b x+c x^2) \sqrt {d+e x+f x^2}} \, dx\) [21]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [B] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [F(-2)]
   Giac [F(-2)]
   Mupad [F(-1)]

Optimal result

Integrand size = 32, antiderivative size = 416 \[ \int \frac {A+B x}{\left (a+b x+c x^2\right ) \sqrt {d+e x+f x^2}} \, dx=\frac {\left (b B-2 A c-B \sqrt {b^2-4 a c}\right ) \text {arctanh}\left (\frac {4 c d-\left (b-\sqrt {b^2-4 a c}\right ) e+2 \left (c e-\left (b-\sqrt {b^2-4 a c}\right ) f\right ) x}{2 \sqrt {2} \sqrt {2 c^2 d-b c e+b^2 f-2 a c f+\sqrt {b^2-4 a c} (c e-b f)} \sqrt {d+e x+f x^2}}\right )}{\sqrt {2} \sqrt {b^2-4 a c} \sqrt {2 c^2 d-b c e+b^2 f-2 a c f+\sqrt {b^2-4 a c} (c e-b f)}}+\frac {\left (2 A c-B \left (b+\sqrt {b^2-4 a c}\right )\right ) \text {arctanh}\left (\frac {4 c d-\left (b+\sqrt {b^2-4 a c}\right ) e+2 \left (c e-\left (b+\sqrt {b^2-4 a c}\right ) f\right ) x}{2 \sqrt {2} \sqrt {2 c^2 d-b c e+b^2 f-2 a c f-\sqrt {b^2-4 a c} (c e-b f)} \sqrt {d+e x+f x^2}}\right )}{\sqrt {2} \sqrt {b^2-4 a c} \sqrt {2 c^2 d-b c e+b^2 f-2 a c f-\sqrt {b^2-4 a c} (c e-b f)}} \]

[Out]

1/2*arctanh(1/4*(4*c*d-e*(b+(-4*a*c+b^2)^(1/2))+2*x*(c*e-f*(b+(-4*a*c+b^2)^(1/2))))*2^(1/2)/(f*x^2+e*x+d)^(1/2
)/(2*c^2*d-b*c*e+b^2*f-2*a*c*f-(-b*f+c*e)*(-4*a*c+b^2)^(1/2))^(1/2))*(2*A*c-B*(b+(-4*a*c+b^2)^(1/2)))*2^(1/2)/
(-4*a*c+b^2)^(1/2)/(2*c^2*d-b*c*e+b^2*f-2*a*c*f-(-b*f+c*e)*(-4*a*c+b^2)^(1/2))^(1/2)+1/2*arctanh(1/4*(4*c*d+2*
x*(c*e-f*(b-(-4*a*c+b^2)^(1/2)))-e*(b-(-4*a*c+b^2)^(1/2)))*2^(1/2)/(f*x^2+e*x+d)^(1/2)/(2*c^2*d-b*c*e+b^2*f-2*
a*c*f+(-b*f+c*e)*(-4*a*c+b^2)^(1/2))^(1/2))*(B*b-2*A*c-B*(-4*a*c+b^2)^(1/2))*2^(1/2)/(-4*a*c+b^2)^(1/2)/(2*c^2
*d-b*c*e+b^2*f-2*a*c*f+(-b*f+c*e)*(-4*a*c+b^2)^(1/2))^(1/2)

Rubi [A] (verified)

Time = 1.74 (sec) , antiderivative size = 416, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.094, Rules used = {1046, 738, 212} \[ \int \frac {A+B x}{\left (a+b x+c x^2\right ) \sqrt {d+e x+f x^2}} \, dx=\frac {\left (-B \sqrt {b^2-4 a c}-2 A c+b B\right ) \text {arctanh}\left (\frac {2 x \left (c e-f \left (b-\sqrt {b^2-4 a c}\right )\right )-e \left (b-\sqrt {b^2-4 a c}\right )+4 c d}{2 \sqrt {2} \sqrt {d+e x+f x^2} \sqrt {\sqrt {b^2-4 a c} (c e-b f)-2 a c f+b^2 f-b c e+2 c^2 d}}\right )}{\sqrt {2} \sqrt {b^2-4 a c} \sqrt {\sqrt {b^2-4 a c} (c e-b f)-2 a c f+b^2 f-b c e+2 c^2 d}}+\frac {\left (2 A c-B \left (\sqrt {b^2-4 a c}+b\right )\right ) \text {arctanh}\left (\frac {2 x \left (c e-f \left (\sqrt {b^2-4 a c}+b\right )\right )-e \left (\sqrt {b^2-4 a c}+b\right )+4 c d}{2 \sqrt {2} \sqrt {d+e x+f x^2} \sqrt {-\sqrt {b^2-4 a c} (c e-b f)-2 a c f+b^2 f-b c e+2 c^2 d}}\right )}{\sqrt {2} \sqrt {b^2-4 a c} \sqrt {-\sqrt {b^2-4 a c} (c e-b f)-2 a c f+b^2 f-b c e+2 c^2 d}} \]

[In]

Int[(A + B*x)/((a + b*x + c*x^2)*Sqrt[d + e*x + f*x^2]),x]

[Out]

((b*B - 2*A*c - B*Sqrt[b^2 - 4*a*c])*ArcTanh[(4*c*d - (b - Sqrt[b^2 - 4*a*c])*e + 2*(c*e - (b - Sqrt[b^2 - 4*a
*c])*f)*x)/(2*Sqrt[2]*Sqrt[2*c^2*d - b*c*e + b^2*f - 2*a*c*f + Sqrt[b^2 - 4*a*c]*(c*e - b*f)]*Sqrt[d + e*x + f
*x^2])])/(Sqrt[2]*Sqrt[b^2 - 4*a*c]*Sqrt[2*c^2*d - b*c*e + b^2*f - 2*a*c*f + Sqrt[b^2 - 4*a*c]*(c*e - b*f)]) +
 ((2*A*c - B*(b + Sqrt[b^2 - 4*a*c]))*ArcTanh[(4*c*d - (b + Sqrt[b^2 - 4*a*c])*e + 2*(c*e - (b + Sqrt[b^2 - 4*
a*c])*f)*x)/(2*Sqrt[2]*Sqrt[2*c^2*d - b*c*e + b^2*f - 2*a*c*f - Sqrt[b^2 - 4*a*c]*(c*e - b*f)]*Sqrt[d + e*x +
f*x^2])])/(Sqrt[2]*Sqrt[b^2 - 4*a*c]*Sqrt[2*c^2*d - b*c*e + b^2*f - 2*a*c*f - Sqrt[b^2 - 4*a*c]*(c*e - b*f)])

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 738

Int[1/(((d_.) + (e_.)*(x_))*Sqrt[(a_.) + (b_.)*(x_) + (c_.)*(x_)^2]), x_Symbol] :> Dist[-2, Subst[Int[1/(4*c*d
^2 - 4*b*d*e + 4*a*e^2 - x^2), x], x, (2*a*e - b*d - (2*c*d - b*e)*x)/Sqrt[a + b*x + c*x^2]], x] /; FreeQ[{a,
b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[2*c*d - b*e, 0]

Rule 1046

Int[((g_.) + (h_.)*(x_))/(((a_) + (b_.)*(x_) + (c_.)*(x_)^2)*Sqrt[(d_.) + (e_.)*(x_) + (f_.)*(x_)^2]), x_Symbo
l] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Dist[(2*c*g - h*(b - q))/q, Int[1/((b - q + 2*c*x)*Sqrt[d + e*x + f*x^2])
, x], x] - Dist[(2*c*g - h*(b + q))/q, Int[1/((b + q + 2*c*x)*Sqrt[d + e*x + f*x^2]), x], x]] /; FreeQ[{a, b,
c, d, e, f, g, h}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[e^2 - 4*d*f, 0] && PosQ[b^2 - 4*a*c]

Rubi steps \begin{align*} \text {integral}& = \frac {\left (2 A c-B \left (b-\sqrt {b^2-4 a c}\right )\right ) \int \frac {1}{\left (b-\sqrt {b^2-4 a c}+2 c x\right ) \sqrt {d+e x+f x^2}} \, dx}{\sqrt {b^2-4 a c}}-\frac {\left (2 A c-B \left (b+\sqrt {b^2-4 a c}\right )\right ) \int \frac {1}{\left (b+\sqrt {b^2-4 a c}+2 c x\right ) \sqrt {d+e x+f x^2}} \, dx}{\sqrt {b^2-4 a c}} \\ & = \frac {\left (2 \left (b B-2 A c-B \sqrt {b^2-4 a c}\right )\right ) \text {Subst}\left (\int \frac {1}{16 c^2 d-8 c \left (b-\sqrt {b^2-4 a c}\right ) e+4 \left (b-\sqrt {b^2-4 a c}\right )^2 f-x^2} \, dx,x,\frac {4 c d-\left (b-\sqrt {b^2-4 a c}\right ) e-\left (-2 c e+2 \left (b-\sqrt {b^2-4 a c}\right ) f\right ) x}{\sqrt {d+e x+f x^2}}\right )}{\sqrt {b^2-4 a c}}+\frac {\left (2 \left (2 A c-B \left (b+\sqrt {b^2-4 a c}\right )\right )\right ) \text {Subst}\left (\int \frac {1}{16 c^2 d-8 c \left (b+\sqrt {b^2-4 a c}\right ) e+4 \left (b+\sqrt {b^2-4 a c}\right )^2 f-x^2} \, dx,x,\frac {4 c d-\left (b+\sqrt {b^2-4 a c}\right ) e-\left (-2 c e+2 \left (b+\sqrt {b^2-4 a c}\right ) f\right ) x}{\sqrt {d+e x+f x^2}}\right )}{\sqrt {b^2-4 a c}} \\ & = \frac {\left (b B-2 A c-B \sqrt {b^2-4 a c}\right ) \tanh ^{-1}\left (\frac {4 c d-\left (b-\sqrt {b^2-4 a c}\right ) e+2 \left (c e-\left (b-\sqrt {b^2-4 a c}\right ) f\right ) x}{2 \sqrt {2} \sqrt {2 c^2 d-b c e+b^2 f-2 a c f+\sqrt {b^2-4 a c} (c e-b f)} \sqrt {d+e x+f x^2}}\right )}{\sqrt {2} \sqrt {b^2-4 a c} \sqrt {2 c^2 d-b c e+b^2 f-2 a c f+\sqrt {b^2-4 a c} (c e-b f)}}+\frac {\left (2 A c-B \left (b+\sqrt {b^2-4 a c}\right )\right ) \tanh ^{-1}\left (\frac {4 c d-\left (b+\sqrt {b^2-4 a c}\right ) e+2 \left (c e-\left (b+\sqrt {b^2-4 a c}\right ) f\right ) x}{2 \sqrt {2} \sqrt {2 c^2 d-b c e+b^2 f-2 a c f-\sqrt {b^2-4 a c} (c e-b f)} \sqrt {d+e x+f x^2}}\right )}{\sqrt {2} \sqrt {b^2-4 a c} \sqrt {2 c^2 d-b c e+b^2 f-2 a c f-\sqrt {b^2-4 a c} (c e-b f)}} \\ \end{align*}

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 9 vs. order 3 in optimal.

Time = 0.44 (sec) , antiderivative size = 278, normalized size of antiderivative = 0.67 \[ \int \frac {A+B x}{\left (a+b x+c x^2\right ) \sqrt {d+e x+f x^2}} \, dx=-\text {RootSum}\left [c d^2-b d e+a e^2+2 b d \sqrt {f} \text {$\#$1}-4 a e \sqrt {f} \text {$\#$1}-2 c d \text {$\#$1}^2+b e \text {$\#$1}^2+4 a f \text {$\#$1}^2-2 b \sqrt {f} \text {$\#$1}^3+c \text {$\#$1}^4\&,\frac {B d \log \left (-\sqrt {f} x+\sqrt {d+e x+f x^2}-\text {$\#$1}\right )-A e \log \left (-\sqrt {f} x+\sqrt {d+e x+f x^2}-\text {$\#$1}\right )+2 A \sqrt {f} \log \left (-\sqrt {f} x+\sqrt {d+e x+f x^2}-\text {$\#$1}\right ) \text {$\#$1}-B \log \left (-\sqrt {f} x+\sqrt {d+e x+f x^2}-\text {$\#$1}\right ) \text {$\#$1}^2}{b d \sqrt {f}-2 a e \sqrt {f}-2 c d \text {$\#$1}+b e \text {$\#$1}+4 a f \text {$\#$1}-3 b \sqrt {f} \text {$\#$1}^2+2 c \text {$\#$1}^3}\&\right ] \]

[In]

Integrate[(A + B*x)/((a + b*x + c*x^2)*Sqrt[d + e*x + f*x^2]),x]

[Out]

-RootSum[c*d^2 - b*d*e + a*e^2 + 2*b*d*Sqrt[f]*#1 - 4*a*e*Sqrt[f]*#1 - 2*c*d*#1^2 + b*e*#1^2 + 4*a*f*#1^2 - 2*
b*Sqrt[f]*#1^3 + c*#1^4 & , (B*d*Log[-(Sqrt[f]*x) + Sqrt[d + e*x + f*x^2] - #1] - A*e*Log[-(Sqrt[f]*x) + Sqrt[
d + e*x + f*x^2] - #1] + 2*A*Sqrt[f]*Log[-(Sqrt[f]*x) + Sqrt[d + e*x + f*x^2] - #1]*#1 - B*Log[-(Sqrt[f]*x) +
Sqrt[d + e*x + f*x^2] - #1]*#1^2)/(b*d*Sqrt[f] - 2*a*e*Sqrt[f] - 2*c*d*#1 + b*e*#1 + 4*a*f*#1 - 3*b*Sqrt[f]*#1
^2 + 2*c*#1^3) & ]

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(804\) vs. \(2(370)=740\).

Time = 1.01 (sec) , antiderivative size = 805, normalized size of antiderivative = 1.94

method result size
default \(-\frac {\left (-2 A c +B \sqrt {-4 a c +b^{2}}+B b \right ) \ln \left (\frac {-\frac {-\sqrt {-4 a c +b^{2}}\, b f +c e \sqrt {-4 a c +b^{2}}+2 a c f -b^{2} f +b c e -2 c^{2} d}{c^{2}}-\frac {\left (f \sqrt {-4 a c +b^{2}}+b f -c e \right ) \left (x +\frac {b +\sqrt {-4 a c +b^{2}}}{2 c}\right )}{c}+\frac {\sqrt {-\frac {2 \left (-\sqrt {-4 a c +b^{2}}\, b f +c e \sqrt {-4 a c +b^{2}}+2 a c f -b^{2} f +b c e -2 c^{2} d \right )}{c^{2}}}\, \sqrt {4 f {\left (x +\frac {b +\sqrt {-4 a c +b^{2}}}{2 c}\right )}^{2}-\frac {4 \left (f \sqrt {-4 a c +b^{2}}+b f -c e \right ) \left (x +\frac {b +\sqrt {-4 a c +b^{2}}}{2 c}\right )}{c}-\frac {2 \left (-\sqrt {-4 a c +b^{2}}\, b f +c e \sqrt {-4 a c +b^{2}}+2 a c f -b^{2} f +b c e -2 c^{2} d \right )}{c^{2}}}}{2}}{x +\frac {b +\sqrt {-4 a c +b^{2}}}{2 c}}\right )}{\sqrt {-4 a c +b^{2}}\, c \sqrt {-\frac {2 \left (-\sqrt {-4 a c +b^{2}}\, b f +c e \sqrt {-4 a c +b^{2}}+2 a c f -b^{2} f +b c e -2 c^{2} d \right )}{c^{2}}}}-\frac {\left (2 A c +B \sqrt {-4 a c +b^{2}}-B b \right ) \ln \left (\frac {-\frac {\sqrt {-4 a c +b^{2}}\, b f -c e \sqrt {-4 a c +b^{2}}+2 a c f -b^{2} f +b c e -2 c^{2} d}{c^{2}}-\frac {\left (-f \sqrt {-4 a c +b^{2}}+b f -c e \right ) \left (x -\frac {-b +\sqrt {-4 a c +b^{2}}}{2 c}\right )}{c}+\frac {\sqrt {-\frac {2 \left (\sqrt {-4 a c +b^{2}}\, b f -c e \sqrt {-4 a c +b^{2}}+2 a c f -b^{2} f +b c e -2 c^{2} d \right )}{c^{2}}}\, \sqrt {4 f {\left (x -\frac {-b +\sqrt {-4 a c +b^{2}}}{2 c}\right )}^{2}-\frac {4 \left (-f \sqrt {-4 a c +b^{2}}+b f -c e \right ) \left (x -\frac {-b +\sqrt {-4 a c +b^{2}}}{2 c}\right )}{c}-\frac {2 \left (\sqrt {-4 a c +b^{2}}\, b f -c e \sqrt {-4 a c +b^{2}}+2 a c f -b^{2} f +b c e -2 c^{2} d \right )}{c^{2}}}}{2}}{x -\frac {-b +\sqrt {-4 a c +b^{2}}}{2 c}}\right )}{\sqrt {-4 a c +b^{2}}\, c \sqrt {-\frac {2 \left (\sqrt {-4 a c +b^{2}}\, b f -c e \sqrt {-4 a c +b^{2}}+2 a c f -b^{2} f +b c e -2 c^{2} d \right )}{c^{2}}}}\) \(805\)

[In]

int((B*x+A)/(c*x^2+b*x+a)/(f*x^2+e*x+d)^(1/2),x,method=_RETURNVERBOSE)

[Out]

-(-2*A*c+B*(-4*a*c+b^2)^(1/2)+B*b)/(-4*a*c+b^2)^(1/2)/c/(-2*(-(-4*a*c+b^2)^(1/2)*b*f+c*e*(-4*a*c+b^2)^(1/2)+2*
a*c*f-b^2*f+b*c*e-2*c^2*d)/c^2)^(1/2)*ln((-(-(-4*a*c+b^2)^(1/2)*b*f+c*e*(-4*a*c+b^2)^(1/2)+2*a*c*f-b^2*f+b*c*e
-2*c^2*d)/c^2-(f*(-4*a*c+b^2)^(1/2)+b*f-c*e)/c*(x+1/2*(b+(-4*a*c+b^2)^(1/2))/c)+1/2*(-2*(-(-4*a*c+b^2)^(1/2)*b
*f+c*e*(-4*a*c+b^2)^(1/2)+2*a*c*f-b^2*f+b*c*e-2*c^2*d)/c^2)^(1/2)*(4*f*(x+1/2*(b+(-4*a*c+b^2)^(1/2))/c)^2-4*(f
*(-4*a*c+b^2)^(1/2)+b*f-c*e)/c*(x+1/2*(b+(-4*a*c+b^2)^(1/2))/c)-2*(-(-4*a*c+b^2)^(1/2)*b*f+c*e*(-4*a*c+b^2)^(1
/2)+2*a*c*f-b^2*f+b*c*e-2*c^2*d)/c^2)^(1/2))/(x+1/2*(b+(-4*a*c+b^2)^(1/2))/c))-(2*A*c+B*(-4*a*c+b^2)^(1/2)-B*b
)/(-4*a*c+b^2)^(1/2)/c/(-2*((-4*a*c+b^2)^(1/2)*b*f-c*e*(-4*a*c+b^2)^(1/2)+2*a*c*f-b^2*f+b*c*e-2*c^2*d)/c^2)^(1
/2)*ln((-((-4*a*c+b^2)^(1/2)*b*f-c*e*(-4*a*c+b^2)^(1/2)+2*a*c*f-b^2*f+b*c*e-2*c^2*d)/c^2-(-f*(-4*a*c+b^2)^(1/2
)+b*f-c*e)/c*(x-1/2/c*(-b+(-4*a*c+b^2)^(1/2)))+1/2*(-2*((-4*a*c+b^2)^(1/2)*b*f-c*e*(-4*a*c+b^2)^(1/2)+2*a*c*f-
b^2*f+b*c*e-2*c^2*d)/c^2)^(1/2)*(4*f*(x-1/2/c*(-b+(-4*a*c+b^2)^(1/2)))^2-4*(-f*(-4*a*c+b^2)^(1/2)+b*f-c*e)/c*(
x-1/2/c*(-b+(-4*a*c+b^2)^(1/2)))-2*((-4*a*c+b^2)^(1/2)*b*f-c*e*(-4*a*c+b^2)^(1/2)+2*a*c*f-b^2*f+b*c*e-2*c^2*d)
/c^2)^(1/2))/(x-1/2/c*(-b+(-4*a*c+b^2)^(1/2))))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 22103 vs. \(2 (369) = 738\).

Time = 277.46 (sec) , antiderivative size = 22103, normalized size of antiderivative = 53.13 \[ \int \frac {A+B x}{\left (a+b x+c x^2\right ) \sqrt {d+e x+f x^2}} \, dx=\text {Too large to display} \]

[In]

integrate((B*x+A)/(c*x^2+b*x+a)/(f*x^2+e*x+d)^(1/2),x, algorithm="fricas")

[Out]

Too large to include

Sympy [F]

\[ \int \frac {A+B x}{\left (a+b x+c x^2\right ) \sqrt {d+e x+f x^2}} \, dx=\int \frac {A + B x}{\left (a + b x + c x^{2}\right ) \sqrt {d + e x + f x^{2}}}\, dx \]

[In]

integrate((B*x+A)/(c*x**2+b*x+a)/(f*x**2+e*x+d)**(1/2),x)

[Out]

Integral((A + B*x)/((a + b*x + c*x**2)*sqrt(d + e*x + f*x**2)), x)

Maxima [F(-2)]

Exception generated. \[ \int \frac {A+B x}{\left (a+b x+c x^2\right ) \sqrt {d+e x+f x^2}} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate((B*x+A)/(c*x^2+b*x+a)/(f*x^2+e*x+d)^(1/2),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*a*c-b^2>0)', see `assume?` f
or more deta

Giac [F(-2)]

Exception generated. \[ \int \frac {A+B x}{\left (a+b x+c x^2\right ) \sqrt {d+e x+f x^2}} \, dx=\text {Exception raised: TypeError} \]

[In]

integrate((B*x+A)/(c*x^2+b*x+a)/(f*x^2+e*x+d)^(1/2),x, algorithm="giac")

[Out]

Exception raised: TypeError >> an error occurred running a Giac command:INPUT:sage2:=int(sage0,sageVARx):;OUTP
UT:Unable to divide, perhaps due to rounding error%%%{%%{poly1[%%%{-4,[3,2,0]%%%}+%%%{16,[1,3,1]%%%},%%%{4,[4,
2,0]%%%}+%%

Mupad [F(-1)]

Timed out. \[ \int \frac {A+B x}{\left (a+b x+c x^2\right ) \sqrt {d+e x+f x^2}} \, dx=\int \frac {A+B\,x}{\left (c\,x^2+b\,x+a\right )\,\sqrt {f\,x^2+e\,x+d}} \,d x \]

[In]

int((A + B*x)/((a + b*x + c*x^2)*(d + e*x + f*x^2)^(1/2)),x)

[Out]

int((A + B*x)/((a + b*x + c*x^2)*(d + e*x + f*x^2)^(1/2)), x)